<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c"  uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>查看用车申请</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="<%=request.getContextPath()%>/static/layui/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="<%=request.getContextPath()%>/static/css/public.css" media="all" />
</head>
<body class="childrenBody">
<form class="layui-form" method="post" id="applyForm">
    <div class="layui-form-item">
        <label class="layui-form-label">申请单单号</label>
        <div class="layui-input-inline">
            <input type="text"  required  lay-verify="required" autocomplete="off" class="layui-input" value="${applyUse.applyno}" disabled>
        </div>
        <label class="layui-form-label">申请人</label>
        <div class="layui-input-inline">
            <input type="text"  required  lay-verify="required" autocomplete="off" class="layui-input" value="${applyUse.user.realname }" disabled>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">用车人</label>
        <div class="layui-input-inline">
            <input type="text"  required  lay-verify="required" placeholder="请输入用车人姓名" autocomplete="off" class="layui-input" value="${applyUse.caruser}" disabled>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">用车时间:</label>
        <div class="layui-input-inline">
            <input type="text"  required  lay-verify="required" placeholder="请输入用车时间" class="layui-input usetime" value="<fmt:formatDate value="${applyUse.usestarttime}"  type="both" />" disabled>
        </div>
        <label class="layui-form-label">预计归还:</label>
        <div class="layui-input-inline">
            <input type="text" required  lay-verify="required" placeholder="请输入预计归还时间" autocomplete="off" class="layui-input usetime" value="<fmt:formatDate value="${applyUse.useendtime}"  pattern="yyyy-MM-dd HH:mm:ss" />" disabled>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">出发地点:</label>
        <div class="layui-input-inline">
            <input type="text"  required  lay-verify="required" placeholder="请输入出发地点" autocomplete="off" class="layui-input" value="${applyUse.go}" disabled>
        </div>
        <label class="layui-form-label">目的地:</label>
        <div class="layui-input-inline">
            <input type="text" required  lay-verify="required" placeholder="请输入目的地" autocomplete="off" class="layui-input" value="${applyUse.back}" disabled>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">事由及说明:</label>
        <div class="layui-input-block">
            <textarea cols="76" rows="12" disabled>
                ${applyUse.remark}
            </textarea>
        </div>
    </div>


    <div class="layui-form-item">
        <label class="layui-form-label">申请单进度:</label>
        <div class="layui-input-inline">
            <input type="text"  autocomplete="off" class="layui-input" value="待发车" disabled>
        </div>
        <label class="layui-form-label">审批时间:</label>
        <div class="layui-input-inline">
            <input type="text"  autocomplete="off" class="layui-input" value="<fmt:formatDate value="${check.checktime}"  pattern="yyyy-MM-dd HH:mm:ss" />" disabled>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">审批意见:</label>
        <div class="layui-input-block">
            <textarea cols="76" rows="12" disabled>
                ${check.remark}
            </textarea>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">审批人:</label>
        <div class="layui-input-inline">
            <input type="text" lay-verify="required" autocomplete="off" class="layui-input" value="${check.checkuser }" disabled>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">派车人:</label>
        <div class="layui-input-inline">
            <input type="text" lay-verify="required" autocomplete="off" class="layui-input" value="${applyUse.sendcaruser }" disabled>
        </div>
        <label class="layui-form-label">派车时间:</label>
        <div class="layui-input-inline">
            <input type="text" id="sendcartime" lay-verify="required" autocomplete="off" class="layui-input" value="<fmt:formatDate value="${applyUse.sendcartime}"  pattern="yyyy-MM-dd HH:mm:ss" />" disabled>
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">起始里程(km):</label>
        <div class="layui-input-inline">
            <input type="text" id="startkm" name="startkm" lay-verify="required" autocomplete="off" class="layui-input" value="${applyUse.car.car_startkm }" readonly="readonly">
        </div>
        <label class="layui-form-label">结束里程(km):</label>
        <div class="layui-input-inline">
            <input type="text" id="endkm" name="endkm" lay-verify="required" autocomplete="off" class="layui-input" placeholder="请输入结束里程数" />
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">还车时间:</label>
        <div class="layui-input-inline">
            <input type="text" name="endtime" id="endtime" lay-verify="required" autocomplete="off" class="layui-input" placeholder="请输入实际返回时间"/>
        </div>

        <label class="layui-form-label">费用(元):</label>
        <div class="layui-input-inline">
            <input type="text" id="price" name="price" lay-verify="required" autocomplete="off" class="layui-input" placeholder="请输入费用">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">备注:</label>
        <div class="layui-input-block">
            <textarea name="remark" id="remark" cols="76" rows="12">正常回车</textarea>
        </div>
    </div>

    <input type="hidden" name="applyid" value="${applyUse.applyid}"/>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="CheckAdd" id="confirmBtn" >确定</button>
            <button class="layui-btn" lay-submit lay-filter="applyAdd" id="closeBtn" >关闭</button>
        </div>
    </div>

</form>
<script type="text/javascript" src="<%=request.getContextPath()%>/static/layui/layui/layui.js"></script>
<script>
    layui.use(['form','layer','laydate','table','laytpl','upload'],function(){
        var form = layui.form,
            layer = parent.layer === undefined ? layui.layer : top.layer,
            $ = layui.jquery,
            laydate = layui.laydate,
            laytpl = layui.laytpl,
            table = layui.table,
            upload=layui.upload;

        //关闭按钮的实现
        $("#closeBtn").click(function () {
            window.parent.location.reload();
        });

        //提交表单
        form.on("submit(CheckAdd)",function(data) {
            // var formData = new FormData($("#applyForm")[0]);
            $.ajax({
                url:"/backCar/backCarCheckAdd",
                type: "post",
                data:$("#applyForm").serialize(),
                success:function (res) {
                    if(res.code == 1001){
                        layui.layer.msg("回车成功");
                    }else{
                        layui.layer.msg("回车失败");
                    }
                }
            });
            //点击提交后关闭悬浮窗
            setTimeout(function () {
                window.parent.location.reload();
            },1500);
            return false;
        });

        var min = $("#sendcartime").val();

        laydate.render({
            elem:'#endtime',
            theme: 'grid',
            type: 'datetime',
            min: min
        });
    });
</script>
</body>
</html>